<link href="../static/ueditor/themes/default/css/ueditor.min.css" type="text/css" rel="stylesheet">
<link href="../static/ueditor/themes/iframe.css" type="text/css" rel="stylesheet">
<div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">
  <div class="layui-form-item">
    <div class="layui-inline">
        <div class="layui-input-inline" style="width: 400px;">
            <script type="text/html" template>
                <input type="text" name="title" value="{{ d.params.title || '' }}" lay-verify="required" placeholder="文章标题" autocomplete="off" class="layui-input">
            </script>
        </div>
    </div>
    <div class="layui-inline" lay-tips="个性地址可以是英文或者英文加数字，不允许出现纯数字、空格和特殊符号">
      <div class="layui-input-inline" style="width:200px;">
            <script type="text/html" template>
                <input type="text" name="id_domain" value="{{ d.params.id_domain || '' }}" placeholder="文章个性地址" autocomplete="off" class="layui-input">
            </script>
        </div>
    </div>
  </div>
  <div class="layui-form-item">
    <div class="layui-inline" lay-tips="多个关键字请用英文逗号分隔“,”">
        <div class="layui-input-inline" style="width:400px;">
            <script type="text/html" template>
                <input type="text" name="keywords" value="{{ d.params.keywords || '' }}" lay-verify="required" placeholder="文章关键字" autocomplete="off" class="layui-input">
            </script>
        </div>
    </div>
    <div class="layui-inline">
        <div class="layui-input-inline">
            <script type="text/html" template lay-url="/api/news/getCategoryList" lay-done="layui.form.render('select');" lay-data="{'lang': layui.data('lang').lang}">
                <select name="category_id" id="category_id" lay-verify="required" >
                    <option value="">请选择</option>
              {{# layui.each(d.data,function(index,item){ }}
                    <option value="{{ item.id }}" {{ item.title === d.params.category_name ? 'selected' : '' }}>{{ item.title }}</option>
              {{# }); }}
                </select>
            </script>
        </div>
    </div>
  </div>
  <div class="layui-form-item">
    <div class="layui-inline">
      <div class="layui-input-inline" style="width:400px;">
            <script type="text/html" template>
                <textarea name="description" placeholder="文章描述" class="layui-textarea">{{ d.params.description || '' }}</textarea>
            </script>
        </div>
    </div>
    <div class="layui-inline">
        <div class="layui-input-inline">
            <script type="text/html" template>
                <input type="text" name="source" value="{{ d.params.source || '' }}" placeholder="文章来源" autocomplete="off" class="layui-input">
            </script>
        </div>
    </div>
  </div>
  <div class="layui-form-item">
    <div class="layui-input-inline" style="width: 345px;">
      <script type="text/html" template>
        <input type="text" name="thumb" id="thumb" value="{{ d.params.thumb || '' }}"  placeholder="请上传图片" autocomplete="off" class="layui-input" >
      </script>
    </div>
    <button type="button" class="layui-btn layui-btn-primary" id="layuiadmin-upload-thumb">上传封面</button>
  <script type="text/html" template>
    {{#
      if(d.params.thumb!=''&&d.params.thumb!=undefined&&d.params.category_id!=3){
    }}
    <button class="layui-btn layui-btn-primary" layadmin-event="PreviewNewImage">查看封面</button>
    {{#
      }
    }}
  </script>
  </div>
  <div class="layui-form-item">
    <div class="layui-input-inline" style="margin-bottom: 20px; width: 80%;">
      <script id="editor" type="text/plain"></script>
    </div>
    <script type="text/html" template>
    <input type="hidden" name="id" value="{{ d.params.id || '' }}">
  </script>
    <script type="text/html" template>
    <input type="hidden" name="lang" value="{{ layui.data('lang').lang }}">
  </script>
  <script type="text/html" template>
    <input type="checkbox" lay-filter="status" name="status" lay-skin="switch" lay-text="显示|隐藏" {{ d.params.status != 0 ? 'checked' : '' }} >
  </script>
  <script type="text/html" template>
    <input type="text" name="news_image" value="{{ d.params.news_image || '' }}">
  </script>
    <div class="layui-form-item">
      <div class="layui-input-inline">
        <input type="button" lay-submit lay-filter="layuiadmin-app-form-submit" value="确认" class="layui-btn">
      </div>
    </div>
  </div>
</div>
<script type="text/javascript" src="https://s1.pstatp.com/cdn/expire-1-M/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="../static/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="../static/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" src="../static/ueditor/index.js"></script>
<script type="text/javascript" charset="utf-8" src="../static/ueditor/lang/zh-cn/zh-cn.js"></script>
  <script>
    layui.use(['admin', 'form', 'upload', 'laydate'], function () {
      var $ = layui.$
        , form = layui.form
        , upload = layui.upload;
      var laydate = layui.laydate;

      //日期时间选择器

      upload.render({
        elem: '#layuiadmin-upload-thumb'
        , url: '/api/uploads/photos/column/news'
        , accept: 'file'
        , method: 'get'
        // ,acceptMime: 'image/*'
        , done: function (res) {
          $(this.item).prev("div").children("input").val(res.data.src)
          // console.log(res)
        }
      });

      form.on('radio(status)', function (data) {
        // console.log(data.elem); //得到radio原始DOM对象
        console.log(data.value); //被点击的radio的value值
      });

    })
    function createTime() {
      var laydate = layui.laydate;

      laydate.render({
        elem: '#test5'
        , type: 'datetime'
        , show: true
      });
    }
  </script>